{php include wl_template('common/header');}
<style type="text/css">
	.page-heading {
    padding: 5px 0;
    border-bottom: 1px solid #ccc;
    margin-bottom: 20px;
    position: relative;
    margin-left: 15px;
</style>
<style>
	td>i{cursor:pointer; display:inline-block; width:100%; height:100%; color:#428bca;}
	.category-caret{display:inline-block; width:20px; margin: 0 10px; text-align:center; cursor:pointer; color:#d9534f;}
	.add.add_level0{cursor:pointer;}
	.panel-stat .panel-heading strong{font-size: 14px}
	.panel-stat{border: #ddd;}
	.panel-stat .panel-heading, .panel-display .panel-heading, .panel-trend .panel-heading{border-color: #DDDDDD; background-color: #F5F5F5;}
	.panel-stat .panel-heading h3, .panel-trend .panel-heading h3, .panel-display .panel-heading h3{display: inline-block; margin-top: 0; margin-bottom: 0; padding-left: 10px; font-size: 14px; font-weight: bold; border-left: 4px solid #06c1ae}
	.panel-stat .panel-heading .pull-right a{color: #2A2A2A}
	.panel-stat .panel-body, .panel-trend .panel-body{margin-top: 15px; background-color: #f8f8f8;}
	.panel-stat .panel-body>div[class*=col-]{border-right: 1px dotted #ccc; background-color: #F5F5F5;padding-top: 5px;}
	.panel-stat .panel-body>div[class*=col-]:last-child{border-right: none}
	.panel-stat .panel-body .title{text-align: center}
	.panel-stat .panel-body .num-wrapper{text-align: center; }
	.panel-stat .panel-body .num{color: #333; font-size: 40px; display: block}
	.panel-stat .panel-body .info{display: inline-block; color: #999}
	.panel-stat .panel-body{width: 100%; margin: 0 auto; padding: 10px;}
</style>
<ul class="nav nav-tabs">
    <li class="active"><a href="javascript:;">数据统计</a></li>
</ul>
<div class="app-content">
    <div class="app-filter">
        <div class="filter-action">
            <a class="btn btn-primary btn-sm" href="{php echo web_url('finace/wlCash/cashSurvey',array('refresh'=>1));}"><i class="fa fa-refresh"></i> 刷新</a>
            <span class="label label-danger"> {$time}更新</span>
            <span>总成交金额：{$allMoney} &nbsp;&nbsp;&nbsp;&nbsp;  最高成交额：{$max}</span>
        </div>
        <div class="filter-list">
            <form action="" method="get" class="form-horizontal" role="form" id="form1">
                <input type="hidden" name="timetype" id="time5" value="{$timetype}"/>
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="{MODULE_NAME}" />
                <input type="hidden" name="p" value="finace" />
                <input type="hidden" name="ac" value="wlCash" />
                <input type="hidden" name="do" value="cashSurvey" />
                <div class="form-group">
                    <label class="col-sm-2 control-label">时间筛选</label>
                    <div class="col-sm-9">
                        <div class="btn-group">
                            <a href="javascript:;" flag = '1' class="btn {if $timetype == 1} btn-primary {else}btn-default {/if} tts" >今天</a>
                            <a href="javascript:;" flag = '2' class="btn {if $timetype == 2} btn-primary {else}btn-default {/if} tts" >最近7天</a>
                            <a href="javascript:;" flag = '3' class="btn {if $timetype == 3} btn-primary {else}btn-default {/if} tts" >最近30天</a>
                            <a href="javascript:;" flag = '0' class="btn {if empty($timetype)} btn-primary {else}btn-default {/if} tts" >全部</a>
                            <a href="javascript:;" flag = '5' class="btn {if $timetype == 5} btn-primary {else}btn-default {/if} timeslot tts" >时间段</a>
                            <!--<a href="javascript:;" class="btn btn-default posi" id="4">公共页面</a>-->
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">商家选择</label>
                    <div class="col-sm-9">
                        <select name="merid" class="form-control">
                            <option value="">商户名称</option>
                            {loop $merchants $mer}
                            <option value="{$mer['id']}" {if $_GPC['merid'] == $mer['id']}selected="selected"{/if}>{$mer['storename']}</option>
                            {/loop}
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label"></label>
                    <div class="col-sm-9">
                        <span class="btn btn-primary"  id="search">查询</span>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <script>
    	$('.timeslot').click(function(){
    		$('.timess').show();
    	});
    	$("#search").click(function(){
			$('#form1')[0].submit();
		});
		$('.tts').click(function(){
			var flag = $(this).attr('flag');
			$('#time5').val(flag);
			if(flag != 5){
				$('.timess').hide();
			}
			$('.tts').each(function(){
				$(this).removeClass('btn-primary');
				$(this).addClass('btn-default');
			});
			$(this).removeClass('btn-default');
			$(this).addClass('btn-primary');
		});
    </script>
	<div class="app-form">
        <form action="" method="post">
            <div class="clearfix">
                <div class="panel panel-stat">
                    <div class="panel-heading">
                        <h3>总览</h3>
                    </div>
                    <div class="panel-body">
                        <div class="col-md-3">
                            <div class="title">
                                订单总额(元)
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="所有支付过的订单的总金额，包括已退款订单。"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-total-fee">￥{$newdata['all']['allmoney']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                订单总数
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="已完成订单：{$newdata['all']['fishorder']}个，未完成订单:{$newdata['all']['ingorder']}个。"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-final-fee">{$newdata['all']['allorder']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                已完成订单金额
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="被标记为已完成或待评价的订单。"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-total-success-order">￥{$newdata['all']['fishordermoney']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                未完成订单金额
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-total-cancel-order">￥{$newdata['all']['ingordermoney']}</span>
                                </a>
                            </div>
                        </div>
                    </div>
                    <div class="panel-body">
                        <div class="col-md-3">
                            <div class="title">
                                代理佣金收入
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="只计算了已结算订单的抽成"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-total-serve-fee">￥{$newdata['all']['sysincome']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                已结算金额
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-total-delivery-fee">￥{$newdata['all']['fishSettlement']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                未结算金额
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="不包括未完成订单的金额"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-total-deliveryer-fee">￥{$newdata['all']['ingSettlement']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                总退款
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-total-refund-fee">￥{$newdata['all']['refund']}</span>
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="clearfix">
                <div class="panel panel-stat">
                    <div class="panel-heading">
                        <h3>团购</h3><span class="pull-right"><a style="color: #428bca;" href="javascript:;" flag="1" plugin="groupon" class="js-plugin-hide">隐藏</a></span>
                    </div>
                    <div class="panel-body" id="groupon-body">
                        <div class="col-md-3">
                            <div class="title">
                                订单总额(元)
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="所有支付过的订单的总金额，包括已退款订单。"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-groupon-fee">￥{$newdata['groupon']['grouponallmoney']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                订单总数
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="已完成订单：{$newdata['groupon']['grouponfishorder']}个，未完成订单:{$newdata['groupon']['grouponingorder']}个。"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-final-fee">{$newdata['groupon']['grouponallorder']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                已完成订单金额
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="被标记为已完成或待评价的订单。"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-groupon-success-order">￥{$newdata['groupon']['grouponfishordermoney']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                未完成订单金额
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-groupon-cancel-order">￥{$newdata['groupon']['grouponingordermoney']}</span>
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="clearfix">
                <div class="panel panel-stat">
                    <div class="panel-heading">
                        <h3>抢购</h3><span class="pull-right"><a style="color: #428bca;" href="javascript:;" flag="1" plugin="rush" class="js-plugin-hide">隐藏</a></span>
                    </div>
                    <div class="panel-body" id="rush-body">
                        <div class="col-md-3">
                            <div class="title">
                                订单总额(元)
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="所有支付过的订单的总金额，包括已退款订单。"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-rush-fee">￥{$newdata['rush']['rushallmoney']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                订单总数
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="已完成订单：{$newdata['rush']['rushfishorder']}个，未完成订单:{$newdata['rush']['rushingorder']}个。"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-final-fee">{$newdata['rush']['rushallorder']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                已完成订单金额
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="被标记为已完成或待评价的订单。"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-rush-success-order">￥{$newdata['rush']['rushfishordermoney']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                未完成订单金额
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-rush-cancel-order">￥{$newdata['rush']['rushingordermoney']}</span>
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="clearfix">
                <div class="panel panel-stat">
                    <div class="panel-heading">
                        <h3>拼团</h3><span class="pull-right"><a style="color: #428bca;" href="javascript:;" flag="1" plugin="fight" class="js-plugin-hide">隐藏</a></span>
                    </div>
                    <div class="panel-body" id="fight-body">
                        <div class="col-md-3">
                            <div class="title">
                                订单总额(元)
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="所有支付过的订单的总金额，包括已退款订单。"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-fight-fee">￥{$newdata['fight']['fightallmoney']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                订单总数
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="已完成订单：{$newdata['fight']['fightfishorder']}个，未完成订单:{$newdata['fight']['fightingorder']}个。"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-final-fee">{$newdata['fight']['fightallorder']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                已完成订单金额
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="被标记为已完成或待评价的订单。"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-fight-success-order">￥{$newdata['fight']['fightfishordermoney']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                            成团数量
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-fight-cancel-order">{$newdata['fight']['successnum']}</span>
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="clearfix">
                <div class="panel panel-stat">
                    <div class="panel-heading">
                        <h3>卡券</h3><span class="pull-right"><a style="color: #428bca;" href="javascript:;" flag="1" plugin="coupon" class="js-plugin-hide">隐藏</a></span>
                    </div>
                    <div class="panel-body" id="coupon-body">
                        <div class="col-md-3">
                            <div class="title">
                                已完成订单金额(元)
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="被标记为已完成或待评价的订单。"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-coupon-fee">￥{$newdata['coupon']['couponallmoney']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                订单总数
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="已完成订单：{$newdata['coupon']['couponfishorder']}个，未完成订单:{$newdata['coupon']['couponingorder']}个。"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-final-fee">{$newdata['coupon']['couponallorder']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                已结算订单金额(元)
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="已结算的卡券订单金额"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-coupon-success-order">￥{$newdata['coupon']['couponfishordermoney']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                            已使用卡券总数
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-coupon-cancel-order">{$newdata['coupon']['couponnum']}</span>
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            {if empty($merchantid)}
            <div class="clearfix">
                <div class="panel panel-stat">
                    <div class="panel-heading">
                        <h3>一卡通</h3><span class="pull-right"><a style="color: #428bca;" href="javascript:;" flag="1" plugin="halfcard" class="js-plugin-hide">隐藏</a></span>
                    </div>
                    <div class="panel-body" id="halfcard-body">
                        <div class="col-md-3">
                            <div class="title">
                                开通订单金额(元)
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="一卡通所有统计订单都为已完成订单。"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-halfcard-fee">￥{$newdata['halfcard']['halfcardallmoney']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                开通次数
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-final-fee">{$newdata['halfcard']['halfcardallorder']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                已结算订单金额(元)
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="已结算的开通一卡通订单金额"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-halfcard-success-order">￥{$newdata['halfcard']['halfcardfishordermoney']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                            一卡通用户数量
                            <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="现有的一卡通用户人数，不会随时间条件改变。"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-halfcard-cancel-order">{$newdata['halfcard']['halfcardnum']}</span>
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="clearfix">
                <div class="panel panel-stat">
                    <div class="panel-heading">
                        <h3>掌上信息</h3><span class="pull-right"><a style="color: #428bca;" href="javascript:;" flag="1" plugin="pocket" class="js-plugin-hide">隐藏</a></span>
                    </div>
                    <div class="panel-body" id="pocket-body">
                        <div class="col-md-3">
                            <div class="title">
                                订单金额(元)
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="掌上信息所有统计订单都为已完成订单。"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-pocket-fee">￥{$newdata['pocket']['pocketallmoney']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                订单数量
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-final-fee">{$newdata['pocket']['pocketallorder']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                                已结算订单金额(元)
                                <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="已结算的开通一卡通订单金额"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-pocket-success-order">￥{$newdata['pocket']['pocketfishordermoney']}</span>
                                </a>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="title">
                            掌上信息帖子数量
                            <i class="fa fa-info-circle" data-toggle="popover" data-placement="top" data-content="现有的帖子数量，不会随时间条件改变。"></i>
                            </div>
                            <div class="num-wrapper">
                                <a class="num" href="javascript:;">
                                    <span id="html-pocket-cancel-order">{$newdata['pocket']['pocketnum']}</span>
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            {/if}
            <div class="app-table-list" style="margin-top:25px;">
                <div class="table-responsive">
                    <table class="table table-hover">
                        <thead>
                        <tr>
                            <th class="text-center" width="45%">商家信息</th>
                            <th class="text-center" width="10%">交易额</th>
                            <th class="text-center" width="45%">所占比例</th>
                        </tr>
                        </thead>
                        <tbody>
                            {loop $agents $item}
                                {loop $children[$item['id']] $ccate}
                                    <tr class="js-collpase js-child-category" pid="{$item['id']}">
                                        <td class="text-left">
                                            <div>
                                                <img src="{php echo tomedia($ccate['logo']);}" width='45' height="45" onerror="$(this).remove()" class="scrollLoading"  />
                                                <input type="text" class="form-control" maxlength="50" style='display:inline;width:calc(100% - 50px);'name="name[{$ccate['id']}]" value="{$ccate['storename']}" />
                                            </div>
                                            </a>
                                        </td>
                                        <td class="text-center">
                                            {$ccate['sMoney']}元
                                        </td>
                                        <td>
                                            <div class="progress" style="margin: auto;">
                                                <div style="width: {$ccate['forpercent']}%;background-color: #78D09F;" class="progress-bar progress-bar-info" ><span style="color:#000">{$ccate['forpercent']}%</span></div>
                                            </div>
                                        </td>
                                    </tr>
                                {/loop}
                            {/loop}
                        </tbody>
                    </table>
                </div>
                <div class="app-table-foot clearfix">
                    <div class="pull-left">

                    </div>
                    <div class="pull-right">
                        {$pager}
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript">
	require(['jquery', 'util'], function($, util){
		$('.js-copy').each(function(){
			var id=$(this).attr('data-id');
			util.clip($("#js-copy"+id), $(this).attr('data-url'));
		});
	});
</script>
<script>
	$(function(){
		//添加父分类
		//控制显示
		$('.js-category-all').click(function() {
			if($(this).hasClass('js-collapse')) {
				$('.js-child-category').fadeOut("slow");
				$('.fa-caret-up').hide();
				$('.fa-caret-down').show();
				$(this).text('全部展开').removeClass('js-collapse');
			} else {
				$('.js-child-category').fadeIn("slow");
				$('.fa-caret-up').show();
				$('.fa-caret-down').hide();
				$(this).text('全部折叠').addClass('js-collapse');
			}
		});

		$('.js-category-up').click(function() {
			var parentId = $(this).attr('pid');
			console.log(parentId);
			$('tr[pid="'+parentId+'"]').fadeOut("slow");
			$(this).prev().show();
			$(this).hide();
		});
		$('.js-category-down').click(function() {
			var parentId = $(this).attr('pid');
			console.log(parentId);
			$('tr[pid="'+parentId+'"]').fadeIn("slow");
			$(this).next().show();
			$(this).hide();
		});
		$('[data-toggle="popover"]').hover(function() {
	        $(this).popover("show");
	    },
	    function() {
	        $(this).popover("hide");
	    });
		$('.js-plugin-hide').click(function(){
	    	var flag = $(this).attr('flag');
	    	var pg =  $(this).attr('plugin');
	    	if(flag>0){
	    		$(this).attr('flag',0);
	    		$('#'+pg+'-body').hide();
	    		$(this).text('显示');
	    	}else{
	    		$(this).attr('flag',1);
	    		$('#'+pg+'-body').show();
	    		$(this).text('隐藏');
	    	}
	    });
	});
</script>
{php include wl_template('common/footer');}